package guda.stark.dal.dao.impl;

import guda.grape.autogen.common.BaseDAO;
import guda.stark.dal.dao.OwnerParkingRelDAO;
import guda.stark.dal.dataobject.OwnerParkingRelDO;
import guda.grape.autogen.common.page.BaseQuery;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class OwnerParkingRelDAOImpl extends BaseDAO implements OwnerParkingRelDAO {

    @Override
	public Long insert(OwnerParkingRelDO ownerParkingRel) {
	      try {
                return (Long) getSqlMapperW().insert("owner_parking_rel.insert",ownerParkingRel);
          } catch (Exception e) {
                throw new RuntimeException(e);
          }

	}

    @Override
	public OwnerParkingRelDO getOwnerParkingRelById(Long relId) {
	    return (OwnerParkingRelDO)getSqlMapClientTemplate().queryForObject("owner_parking_rel.getOwnerParkingRelById", relId);
	}

    @Override
	public boolean delOwnerParkingRelById(Long relId) {
	    int num = 0;
        try {
            num = getSqlMapperW().delete("owner_parking_rel.delOwnerParkingRelById",relId);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        if(num>0){
            return true;
        }else{
            return false;
        }
	}

    @Override
	public List<OwnerParkingRelDO> getOwnerParkingRelByIds(List idsList) {
        Map m = new HashMap();
        m.put("idsList",idsList);
		return getSqlMapClientTemplate().queryForList("owner_parking_rel.selectByIds", m);
	}

    @Override
	public void cleanAutoIncrement(Long relId) {
	    try {
            getSqlMapperW().update("owner_parking_rel.cleanAutoIncrement",relId);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
	}

    @Override
    public List<OwnerParkingRelDO> selectForPage(BaseQuery baseQuery) {
        return getSqlMapClientTemplate().queryForList("owner_parking_rel.selectForPage", baseQuery);
    }

    @Override
    public int countForPage(BaseQuery baseQuery) {
        return (Integer)getSqlMapClientTemplate().queryForObject("owner_parking_rel.countForPage",baseQuery);
    }

    @Override
    public void updateByIdSelective(OwnerParkingRelDO ownerParkingRel) {
        try {
            getSqlMapperW().update("owner_parking_rel.updateByIdSelective",ownerParkingRel);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}

